package HuaWeiPractice;

import java.util.Scanner;

/**
 * created by ysy 2022/3/3 17:15
 * 华为机试数字颠倒
 *
 * @author 杨双洋
 * @version 1.0
 * @Email Yangsybd@163.com
 */
public class ReverseTest {
    public static void main(String[] args) {
        System.out.println("请输入数字字符串");
        Scanner sc = new Scanner(System.in);
        String number = sc.nextLine();
        //声明StringBuffer对象，使用StringBuffer的append方法，附加String参数字符
        StringBuffer sb = new StringBuffer();
        StringBuffer appendStr = sb.append(number);
        //reverse方法导致StringBuffer序列被序列的相反代替
        StringBuffer reverseStr = appendStr.reverse();
        System.out.println(reverseStr.toString());
    }
}

